import request from '@/utils/request'

// 查询入库类型列表
export function listPutstorage(query) {
  return request({
    url: '/repertory/putstorage/list',
    method: 'get',
    params: query,
  })
}

// 查询入库类型详细
export function getPutstorage(psId) {
  return request({
    url: '/repertory/putstorage/' + psId,
    method: 'get',
  })
}

// 新增入库类型
export function addPutstorage(data) {
  return request({
    url: '/repertory/putstorage',
    method: 'post',
    data: data,
  })
}

// 修改入库类型
export function updatePutstorage(data) {
  return request({
    url: '/repertory/putstorage',
    method: 'put',
    data: data,
  })
}

// 删除入库类型
export function delPutstorage(psId) {
  return request({
    url: '/repertory/putstorage/' + psId,
    method: 'delete',
  })
}

// 导出入库类型
export function exportPutstorage(query) {
  return request({
    url: '/repertory/putstorage/export',
    method: 'get',
    params: query,
  })
}
//修改状态
export function changedpStorageFlag(psId, flag, psCode) {
  const data = {
    psId,
    flag,
    psCode,
  }
  return request({
    url: '/repertory/putstorage/changeFlag',
    method: 'put',
    data: data,
  })
}

//获取入库字典类型
export function getPstorageType(flag) {
  return request({
    url: '/repertory/putstorage/pstorageTypeDict/' + flag,
    method: 'get',
  })
}

export function produceState(data) {
  return request({
    url: '/production/Report/produce_state',
    method: 'get',
    params: data,
  })
}

/**
 * @description: 生成二维码
 * @param {*} data
 * @return {*}
 */
export function generateQr(data) {
  return request({
    url: '/putStorage/rrqDet/generate',
    method: 'post',
    data: data,
  })
}

/**
 * @description: 二维码入库
 * @param {*} id 二维码id
 * @return {*}
 */
export function warehousingQr(id, data) {
  return request({
    url: `/putStorage/rrqDet/warehousing/${id}`,
    method: 'put',
    data: data,
  })
}
/**
 * @description: 二维码半成品入库
 * @param {*} id 二维码id
 * @return {*}
 */
export function selectRrqDetByRrqId(id, data) {
  return request({
    url: `/putStorage/rrqDet/selectRrqDetByRrqId/${id}`,
    method: 'get',
  })
}

/**
 * @description: 二维码半成品入库
 * @param {*} id 二维码id
 * @return {*}
 */
export function halfOutOfStock(id, rrqKysl, data) {
  return request({
    url: `/putStorage/rrqDet/halfOutOfStock/${id}/${rrqKysl}`,
    method: 'put',
    data: data,
  })
}
/**
 * @description: 二维码出库
 * @param {*} id 二维码id
 * @return {*}
 */
export function outOfStockQr(id) {
  return request({
    url: `/putStorage/rrqDet/outOfStock/${id}`,
    method: 'put',
  })
}
/**
 * @description: 美的二维码出库
 * @param {*}
 * @return {*}
 */
export function outOfByCustomer(customer, number) {
  return request({
    url: `/putStorage/rrqDet/outOfByCustomer/${customer}/${number}`,
    method: 'put',
  })
}

/**
 * @description: 二维码出库
 * @param {*} id 二维码id
 * @return {*}
 */
export function updatePrint() {
  return request({
    url: `/putStorage/rrqDet/updatePrint`,
    method: 'put',
  })
}
/**
 * @description: 产品二维码打印
 * @param {*}
 * @return {*}
 */
export function generateProdQr(data) {
  return request({
    url: `/qr/car/generate`,
    method: 'post',
    data: data,
  })
}
export function updatePrintProdQr(data) {
  return request({
    url: `/qr/car/updatePrint`,
    method: 'put',
    data,
  })
}

/**
 * @description: 生产扫码
 * @param {*} id 二维码id
 * @return {*}
 */
export function productionScan(data) {
  return request({
    url: `/qr/car/productionScan`,
    method: 'post',
    data,
  })
}
